<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            background-color: red;
            width: 200px;
            height: 200px;
        }

        .s {
            font-size: 30px;
        }

        .btn {
            border: none;
            outline: none;
            background-color: pink;

        }

        .btnSize {
            font-size: 60px;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- <div style="font-size: 20px;color:red;">hello style bind</div> -->
        <!-- :style绑定 对象和数组 -->
        <!-- <div :style="{'font-size': '20px'}">hello style bind</div> -->
        <div :style="{fontSize: '60px',color:'red',backgroundColor: isBg?'red':'blue'}">hello style bind</div>
        <!-- 数组语法 -->
        <div :style="[isBg?styleObj:'']" @click="isBg=!isBg">数组</div>
    </div>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script>
        const { ref, reactive, watch, createApp, toRefs, watchEffect, computed } = Vue;
        createApp({
            setup() {
                const isBg = ref(false)
                const styleObj = reactive({
                    fontSize: '60px',
                    color: 'red',
                    backgroundColor: isBg.value ? 'red' : 'blue'
                })
                return {
                    isBg,
                    styleObj
                }


            }
        }).mount('#app')
    </script>
</body>

</html>